﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using MMITDomain.Abstract;
using MMITDomain.Entities;

namespace MMITDomain.Concrete
{
    public class EFTransactionRoleTransactionTypeRepository : ITransactionRoleTransactionTypeRepository
    {
        EFDbContext dbContext = new EFDbContext();
        
        #region ITransactionRoleTransactionTypeRepository Members

        public IQueryable<TransactionRoleTransactionType> TransactionRoleTransactionTypes
        {
            get 
            { 
                return dbContext.TransactionRoleTransactionTypes; 
            }
        }

        public void SaveTransactionRoleTransactionType(TransactionRoleTransactionType objTransactionRoleTransactionType)
        {
            if (objTransactionRoleTransactionType.Id == 0)
            {
                dbContext.TransactionRoleTransactionTypes.Add(objTransactionRoleTransactionType);
            }

            dbContext.SaveChanges();
        }

        public void DeleteTransactionRoleTransactionType(TransactionRoleTransactionType objTransactionRoleTransactionType)
        {
            dbContext.TransactionRoleTransactionTypes.Remove(objTransactionRoleTransactionType);

            dbContext.SaveChanges();
        }

        #endregion
    }
}
